import {TableInfo} from "~/api/requestInstance";

export interface Result<T> {
    code: string;
    success: boolean;
    message: string;
    data: T;
    total: number;
}

/**
 * 导入记录vo
 */
export interface ImportRecordVO {
    pid: string;
    originalFileUrl: string;
    sheetData: object;
    s3Key: string;
    fileName: string;
}

export interface UserBO {
    userPid: string;
    userIcon: string;
    realName: string;
    departmentCode: string;
    positionPid: number;
    hrCode: string;
    departmentName: string;
}

// export interface Classify {
//     pid: string;
//     classifyName: string;
// }

export interface TableInfoPageVO {
    pid: string;
    tableName: string;
    createUserName: string;
    createDate: string;
    tableClassifyPid: string;
    identity: number;
}

export interface ImportPageVO {
    pid: string;
    tableName: string;
    importState: string;
    operationType: string;
    createDate: string;
    failedDataNum: number;
    // 操作人
    createUserName: string;
}

// 类
export class Classify {
    private _pid: string;
    private _classifyName: string;

    constructor(pid: string, classifyName: string) {
        this._pid = pid;
        this._classifyName = classifyName;
    }


    public get pid(): string {
        return this._pid;
    }

    public set pid(value: string) {
        this._pid = value;
    }

    public get classifyName(): string {
        return this._classifyName;
    }

    public set classifyName(value: string) {
        this._classifyName = value;
    }
}

export interface ExcelDomain {
    sheetName: string;
    maxColumn: number;
    tableHead: Array<any>;
    tableData: Array<Array<any>>;
    listMap: Array<object>;
}

export interface UserVO {
    userId: string;
    userLabel: string;
}

export interface Permission {
    administrators: Array<string>;
    ordinaryUsers: Array<string>;
    departmentAndPosition: boolean;
    departments: Array<string>;
    positions: Array<string>;
}

export interface DepartmentVO {
    departmentCd: string;
    departmentName: string;
    departmentPCd: string;
    departmentList: Array<DepartmentVO>;
}

export interface PositionVO {
    positionId: string;
    positionName: string;
}

export interface TableFieldVO {
    pid: string;
    fieldName: string;
    fieldApi: string;
    fieldType: string;
    notNull: boolean;
    defaultValue: string;
    decimalLength: number;
    only: boolean;
    columnNo: number;
}

export interface TableDetailedVO {
    tableVO: TableInfo;
    tableFieldVOMap: any
}

export interface ImportResultVO {
    // 导入进度
    importProgress: string;
    // 导入状态
    importState: string;

    // 导入方式
    importMode: string;

    // 原始文件
    originalFileUrl: string;

    // s3key
    s3Key: string;

    // 文件类型
    fileType: string;

    // 当前导入的sheet
    sheetName: string;

    // 当前导入进行至的条数
    currentNumber: number;

    // 文件数据量
    dataQuantity: number;

    // 无效的数据量
    invalidDataQuantity: number;

    // 重复的数据量
    repetitiveDataQuantity: number;

    // 未匹配的数据量
    mismatchDataQuantity: number;

    // 新增的数据量
    addDataQuantity: number;

    // 修改的数据量
    updateDataQuantity: number;

    // 失败的数据文件
    unsuccessfulFileUrl: string;

    // 是否已删除 false 未删除 true 已删除
    dataDel: boolean;
}

export interface CommonSearchVO {
    pid: string;
    userPid: string;
    tablePid: string;
    searchName: string;
    searchContent: string;
    searchContentMap: any;
}

export interface ClassifyVO {
    pid: string;
    classifyName: string;
}

export interface DepartmentClassifyVO {
    departmentCode: string;
    departmentName: string;
    classifyVOList: Array<ClassifyVO>
}
